'\" te
.\"  Copyright (c) 2002 by Sun Microsystems, Inc.  All rights reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH RSM_MEMSEG_GET_POLLFD 3RSM "Dec 1, 2002"
.SH NAME
rsm_memseg_get_pollfd, rsm_memseg_release_pollfd \- get or release a poll
descriptor
.SH SYNOPSIS
.LP
.nf
cc [ \fIflag\fR... ] \fIfile\fR... -lrsm [ \fIlibrary\fR... ]
#include <rsmapi.h>

\fBint\fR \fBrsm_memseg_get_pollfd\fR(\fBvoid *\fR\fImemseg\fR, \fBstruct pollfd *\fR\fIfd\fR);
.fi

.LP
.nf
\fBint\fR \fBrsm_memseg_release_pollfd\fR(\fBvoid *\fR\fImemseg\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBrsm_memseg_get_pollfd()\fR and \fBrsm_memseg_release_pollfd()\fR
functions provide an alternative to \fBrsm_intr_signal_wait\fR(3RSM). The
waiting process can multiplex event waiting using the \fBpoll\fR(2) function
after first obtaining a poll descriptor using \fBrsm_memseg_get_pollfd()\fR.
The descriptor can subsequently be released using
\fBrsm_memseg_release_pollfd()\fR.
.sp
.LP
As a result of a call \fBrsm_memseg_get_pollfd()\fR, the specified \fBpollfd\fR
structure is initialized with a descriptor for the specified segment
(\fImemseg\fR) and the event generated by \fBrsm_intr_signal_post\fR(3RSM).
Either an export segment handle or an import segment handle can be type cast to
a void pointer. The \fIpollfd\fR argument can subsequently be used with the
\fBrsm_intr_signal_wait_pollfd\fR(3RSM) function to wait for the event; it
cannot be used with \fBpoll()\fR. If \fImemseg\fR references an export segment,
the segment must be currently published.  If \fImemseg\fR references an import
segment, the segment must be connected.
.sp
.LP
The \fBrsm_memseg_reslease_pollfd()\fR function decrements the reference count
of the \fBpollfd\fR structure associated with the specified segment.  A segment
unpublish, destroy or unmap operation will fail if the reference count is
non-zero.
.SH RETURN VALUES
.sp
.LP
Upon successful completion, these functions return 0.  Otherwise, an error
value is returned to indicate the error.
.SH ERRORS
.sp
.LP
The \fBrsm_memseg_get_pollfd()\fR and \fBrsm_memseg_release_pollfd()\fR
function can return the following error:
.sp
.ne 2
.na
\fB\fBRSMERR_BAD_SEG_HNDL\fR \fR
.ad
.RS 24n
Invalid segment handle.
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
l | l
l | l .
ATTRIBUTE TYPE 	ATTRIBUTE VALUE
_
Interface Stability	Evolving
_
MT-Level	MT-Safe
.TE

.SH SEE ALSO
.sp
.LP
.BR poll (2),
.BR rsm_intr_signal_post (3RSM),
.BR rsm_intr_signal_wait_pollfd (3RSM),
.BR attributes (7)
